<template>
    <div>
        <el-drawer title="" :visible.sync="drawer" :direction="direction" :before-close="handleClose" custom-class="drawer-info">
            <div class="info-item">
                <h5 class="from-title">基本信息</h5>
                <div class="form-item">
                    <label class="form-item-label">字段标题:</label>
                    <div class="form-item-content">{{ objInfo.colTitle }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">字段名:</label>
                    <div class="form-item-content">{{ objInfo.colName }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">标签引用名:</label>
                    <div class="form-item-content">{{ objInfo.propName }}
                    </div>
                </div>
                <div class="form-item">
                    <label class="form-item-label">字段类型:</label>
                    <div class="form-item-content">{{ objInfo.colType }}
                    </div>
                </div>
            </div>
        </el-drawer>
    </div>
</template>
<script>
    import { memberextendfieldconfigInfo } from "@/api/member/memberextendfieldconfig.js";
    import { enumList, } from "@/api/public.api.js";
    export default {
        data() {
            return {
                drawer: true,
                direction: "rtl",
                objInfo: {},
                YesNoList:[],
                ValidateTypeList:[],
                ViewFormTypeList:[],
            }
        },
        created() {
        },
        methods: {
          queryEnumList(){
              this.YesNoList = [];
              enumList("YesNo","").then((resp) => {
                if (resp.code == 0) {
                  this.YesNoList = resp.data;
                }
              });
              this.ValidateTypeList = [];
              enumList("ValidateType","").then((resp) => {
                if (resp.code == 0) {
                  this.ValidateTypeList = resp.data;
                }
              });
              this.ViewFormTypeList = [];
              enumList("ViewFormType","").then((resp) => {
                if (resp.code == 0) {
                  this.ViewFormTypeList = resp.data;
                }
              });
          },
            init(id) {
                this.queryEnumList();
                if (id) {
                   memberextendfieldconfigInfo(id).then(res => {
                        this.objInfo = res.data
                              let validateTypeObj = this.ValidateTypeList.find((item) => {
                                return item.code == this.objInfo.validateType;
                              });
                              this.objInfo.validateTypeName = validateTypeObj ? validateTypeObj.name : "";
                              let formTypeObj = this.ViewFormTypeList.find((item) => {
                                return item.code == this.objInfo.formType;
                              });
                              this.objInfo.formTypeName = formTypeObj ? formTypeObj.name : "";
                   })

                }
                this.drawer = true
            },
            // 关闭抽屉
            handleClose(done) {
                done()
            },
        },
    }
</script>
<style scoped>
    .from-title {
        margin-bottom: 20px;
        padding: 0 20px 20px 20px;
        font-size: 16px;
        color: #17233d;
        border-bottom: 1px solid #eee;
    }
    .info-item {
        margin-bottom: 40px;
    }

    .form-item {
        margin-bottom: 20px;
        font-size: 14px;
    }
    .form-item-label {
        text-align: right;
        float: left;
        width: 25%;
    }
    .form-item-content {
        margin-left: 30%;
        width: 70%;
    }
</style>
